# Base Configration
unbind-key C-b
set -g prefix 'C-a'
bind-key 'C-a' send-prefix

bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1

set -g default-terminal "screen-256color"
set -g status-keys vi
setw -g mode-keys vi
set-option -sg escape-time 10

# Manipulate windows and panels like vi
unbind '"'
unbind %
bind x split-window -v -c '#{pane_current_path}'
bind v split-window -h -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

bind q killp

bind r source-file ~/.tmux.conf \; display "Reloaded!"

#####status bar#####

# Disable status bar
# set -g status off
set -g pane-border-style fg='#303030',bg=black
set -g pane-active-border-style fg='#00afff',bg=black
set -g status-style bg='#0C8A92',fg=black

set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-left '#[fg=colour233,bg=colour241,bold][#[fg=colour233,bg=colour241,bold]s#S:w#I.p#P#[fg=colour233,bg=colour241,bold]]#[bg=colour234] '
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20

setw -g window-status-current-format '#[fg=colour236,bg=colour245,bold]#I#[fg=colour233,bg=colour245,bold]:#[fg=colour233,bg=colour245,bold]#W#[fg=colour233,bg=colour245,bold]#F '
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

# Number windows starting at 1, renumber as windows are added / removed
set -g base-index 1
set -g renumber-windows on

# Setup 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-selection

# plugins
# First:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-vim 'session'
set -g @plugin 'christoomey/vim-tmux-navigator'

run '~/.tmux/plugins/tpm/tpm'
